<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/WEB-TAG/platForm.tld" prefix="PF"%>
<!--流程实例选择-->
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		<table id="dom_choosegridIdentityactruexecution">
			<thead>
				<tr>
					<th data-options="field:'ck',checkbox:true"></th>
					<th field="USERID" data-options="sortable:false" width="80">
						用户ID
					</th>
					<th field="TASKID" data-options="sortable:false" width="80">
						任务ID
					</th>
					<th field="TYPE" data-options="sortable:false" width="80">
						参与者类型
					</th>
					<th field="GROUPID" data-options="sortable:false" width="80">
						组ID
					</th>
				</tr>
			</thead>
		</table>
	</div>
</div>
<script type="text/javascript">
	var choosegridIdentityActruexecution;
	var chooseSearchIdentityActruexecution;
	var toolbar_chooseIdentityactruexecution = [ {
		text : '添加用户',
		iconCls : 'icon-add',
		handler : function() {
			$.messager.prompt('提示信息', '请输入用户ID：', function(r){
				if (r){
					$.post("admin/ActReProcdefStarterUseraddCommit.do", {processDefId:'${ids}',id:r},
							function(flag) {
								if (flag.pageset.commitType == 0) {
									$(choosegridIdentityActruexecution).datagrid('reload');
								} else {
									var str = MESSAGE_PLAT.ERROR_SUBMIT
											+ flag.pageset.message;
									$.messager.alert(MESSAGE_PLAT.ERROR, str,
											'error');
								}
							});
				}
			});
		}
	},{
		text : '添加角色',
		iconCls : 'icon-add',
		handler : function() {
			$.messager.prompt('提示信息', '请输入角色ID：', function(r){
				if (r){
					$.post("admin/ActReProcdefStarterRoleaddCommit.do", {processDefId:'${ids}',id:r},
							function(flag) {
								if (flag.pageset.commitType == 0) {
									$(choosegridIdentityActruexecution).datagrid('reload');
								} else {
									var str = MESSAGE_PLAT.ERROR_SUBMIT
											+ flag.pageset.message;
									$.messager.alert(MESSAGE_PLAT.ERROR, str,
											'error');
								}
							});
				}
			});
		}
	}, {
		text : '删除',
		iconCls : 'icon-remove',
		handler : function() {
			var selectedArray = $(choosegridIdentityActruexecution).datagrid('getSelections');
			if (selectedArray.length > 0) {
				// 有数据执行操作
				var str = selectedArray.length + MESSAGE_PLAT.SUCCESS_DEL_NEXT_IS;
				$.messager.confirm(MESSAGE_PLAT.PROMPT, str, function(flag) {
					if (flag) {
						var id=selectedArray[0].ID;
						if(!id){
							id=selectedArray[0].GROUPID;
						}
						$.post("admin/ActReProcdefStartDelCommit.do",
								 {ids:id,processDefId:'${ids}'},
								function(flag) {
									if (flag.pageset.commitType == 0) {
										$(choosegridIdentityActruexecution).datagrid('reload');
									} else {
										var str = MESSAGE_PLAT.ERROR_SUBMIT
												+ flag.pageset.message;
										$.messager.alert(MESSAGE_PLAT.ERROR, str,
												'error');
									}
								});
					}
				});
			} else {
				$.messager.alert(MESSAGE_PLAT.PROMPT, MESSAGE_PLAT.CHOOSE_ONE,
						'info');
			}
		}
	} ];
	$(function() {
		//初始化数据表格
		choosegridIdentityActruexecution = $(
				'#dom_choosegridIdentityactruexecution').datagrid( {
			url : "admin/ActReProcdefqueryStarter.do?ids=${ids}",
			fit : true,
			fitColumns : true,
			'toolbar' : toolbar_chooseIdentityactruexecution,
			pagination : true,
			closable : true,
			checkOnSelect : true,
			striped : true,
			rownumbers : true,
			ctrlSelect : true
		});
	});
	//-->
</script>
